// 组件
import YzwSelectLinkage from '../package/components/yzw-select-linkage/index.vue'//省-市-区-街道联动
import YzwCarousel from '../package/components/yzw-carousel/index.vue'//淡入淡出轮播图
// 指令
import focus from '../package/directive/focus/index' //聚焦
import drag from '../package/directive/drag/index' //拖拽
import color from '../package/directive/color/index' //颜色
import loadMore from '../package/directive/loadMore/index' //下拉加载
import debounce from '../package/directive/debounce/index' //防抖
import throttle from '../package/directive/throttle/index' //节流
import lazy from '../package/directive/lazy/index' //图片懒加载
// 组件数组
const components = [YzwSelectLinkage, YzwCarousel] // 将来如果有其它组件,都可以写到这个数组里
// 指令数组
const directives = [focus, drag, color, loadMore, debounce, throttle, lazy] // 将来如果有其它指令,都可以写到这个数组里
// 批量组件注册
const install = function (Vue) {
  // 注册组件
  components.forEach((item) => {
    Vue.component(item.name, item)
  })
  // 注册指令
  directives.forEach((item) => {
    Vue.directive(item.title, item.fun())
  })
}

export default install // 这个方法以后再使用的时候可以被use调用
